home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / EasyPHP-2.0b1-setup.exe / {app} / phpmyadmin / libraries / sanitizing.lib.php < prev    next >
Encoding:
PHP Script  |  2006-11-18  |  1.2 KB  |  41 lines

  1. <?php
  2. /* $Id: sanitizing.lib.php 7802 2005-11-17 13:12:58Z cybot_tm $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. /**
  6.  * Sanitizes $message, taking into account our special codes
  7.  * for formatting
  8.  *
  9.  * @param   string   the message
  10.  *
  11.  * @return  string   the sanitized message
  12.  *
  13.  * @access  public
  14.  */
  15. function PMA_sanitize($message)
  16. {
  17.     $replace_pairs = array(
  18.         '<'         => '<',
  19.         '>'         => '>',
  20.         '[i]'       => '<em>',      // deprecated by em
  21.         '[/i]'      => '</em>',     // deprecated by em
  22.         '[em]'      => '<em>',
  23.         '[/em]'     => '</em>',
  24.         '[b]'       => '<strong>',  // deprecated by strong
  25.         '[/b]'      => '</strong>', // deprecated by strong
  26.         '[strong]'  => '<strong>',
  27.         '[/strong]' => '</strong>',
  28.         '[tt]'      => '<code>',    // deprecated by CODE or KBD
  29.         '[/tt]'     => '</code>',   // deprecated by CODE or KBD
  30.         '[code]'    => '<code>',
  31.         '[/code]'   => '</code>',
  32.         '[kbd]'     => '<kbd>',
  33.         '[/kbd]'    => '</kbd>',
  34.         '[br]'      => '<br />',
  35.         '[/a]'      => '</a>',
  36.     );
  37.     return preg_replace('/\[a@([^"@]*)@([^]"]*)\]/', '<a href="\1" target="\2">', strtr($message, $replace_pairs));
  38. }
  39.  
  40. ?>
  41.